function AddFav(u, t) {
  if (document.all) {
  window.external.AddFavorite(u, t);
  } else{
  window.sidebar.addPanel(t, u, "");
  }
  return false;
}
$(function(){
	$.cookie( 'idcode' ,'' , 1 );
	$.idcode.setCode();
	$("#name").validatebox( {required:true,missingMessage:"登陆名不能为空" });
	$("#password").validatebox( {required:true,missingMessage:"密码不能为空" });
	
	$("form").submit( function(){
		$("#code").validatebox( {required:true,missingMessage:"验证码不能为空" });
		
		var flag = checkValidate(['name','password' , 'code' ]);
		if( !$.idcode.validateCode() ){
			$('#code').val('');
			return false;
		}
		if( flag )
			$.cookie( 'idcode' ,$.idcode.getCode() , 1 );
		else
			return false;
	});
	$("#code").focus(function(){
		$.idcode.setCode();
		$("#code").validatebox( {required:false,missingMessage:"验证码不能为空" });
	});
});